# -*- coding:utf-8 -*-
# Created by Jin(jinzhencheng@outlook.com) at 2018/08/01.

import  hashlib

def build_md5_code(the_str):
    md5_handle = hashlib.md5()
    md5_handle.update(the_str)

    return md5_handle.hexdigest()

def build_cookies(cookies_str):
    cookies_dict = dict()
    for cookie in cookies_str:
        for item in cookie.split(';'):
            index = item.index('=')
            cookies_dict[item[:index]] = item[index + 1:]
    return cookies_dict

